package com.mxpio.erp.common.order.service;

import com.mxpio.erp.common.enums.OrderStatusEnums;
import com.mxpio.erp.common.jpa.model.Order;
import com.mxpio.erp.common.order.policy.OrderContext;
import com.mxpio.erp.common.order.policy.OrderPolicy;
import com.mxpio.erp.common.vo.NoticeClassVo;
import com.mxpio.erp.common.vo.OrderExcuteLineVo;
import com.mxpioframework.common.vo.Result;
import com.mxpioframework.system.service.BaseService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface OrderService extends BaseService<Order> {
	
	/**
	 * 通用的单据执行方法
	 * @param order
	 * @param policy
	 * @return
	 */
	OrderContext execute(Order order, OrderPolicy policy);
	
	/**
	 * 更新审批状态
	 * @param bizOrder
	 * @param bpmnStatus
	 * @return
	 */
	Result<? extends Order> updateBpmnStatus(Order bizOrder, OrderStatusEnums.BpmnStatus bpmnStatus);

	/**
	 * 更新关闭状态
	 * @param bizOrder
	 * @param closeStatus
	 * @return
	 */
    Result<? extends Order> updateCloseStatus(Order bizOrder, OrderStatusEnums.CloseStatus closeStatus);
    
    /**
     * 更新订单状态
     * @param bizOrder
     * @param orderStatus
     * @return
     */
    Result<? extends Order> updateOrderStatus(Order bizOrder, OrderStatusEnums.OrderStatus orderStatus);

	void handleBizOrderQuantity(List<? extends Order> orders,List<NoticeClassVo> noticeClassVos, String accessType);

	@Transactional(readOnly = true)//关联是否入库检验信息 带供应链校验
	void handleInQualityControl(String pnCode, List<OrderExcuteLineVo> lines);

	@Transactional(readOnly = true)//关联是否入库检验信息
	void handleInQualityControl(List<OrderExcuteLineVo> lines);
}
